﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xunit;
using M3G;

namespace MyTestProject {
    public class TestCollisionDetect {

        [Fact]
        public void TestCollide () {
            var csh1 = new CollisionShape ();
            var csh2 = new CollisionShape ();
            var vertices1 = new float[]{0,0,0,
                                       1,1,1};
            var vertices2 = new float[]{1,1,1,
                                        2,2,2};
            var orientations = 1 << 2 | 1 << 1 | 1 << 0;
            csh1.ConstructKDOP (orientations, vertices1);
            csh2.ConstructKDOP (orientations, vertices2);

            Assert.Equal (true, csh1.Intersect (csh2));
            Assert.Equal (true, csh2.Intersect (csh1));
        }
        
        [Fact]
        public void TestNotCollide () {
            var csh1 = new CollisionShape ();
            var csh2 = new CollisionShape ();
            var vertices1 = new float[]{0,0,0,
                                       1,1,1};
            var vertices2 = new float[]{2,2,2,
                                        3,3,3};
            var orientations = 1 << 2 | 1 << 1 | 1 << 0;
            csh1.ConstructKDOP (orientations, vertices1);
            csh2.ConstructKDOP (orientations, vertices2);

            Assert.Equal(false, csh1.Intersect (csh2));
            Assert.Equal (false, csh2.Intersect (csh1));
        }

    }
}
